﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using YasharEl.Infrastructure.OrgUnit.EntityModel;

namespace YasharEl.Infrastructure.OrgUnit.PersistanceModel.NHibernate.Mappings
{
    public class ManagerEntityMap : SubclassMap<ManagerEntity>
    {
        public ManagerEntityMap()
        {
            Extends<EmployeeEntity>();
            DiscriminatorValue("1");

            HasMany<EmployeeEntity>(e => e.DirectSubordinates)
                .PropertyRef("IdentityNumber")
                .Inverse()
                .LazyLoad()
                .Cascade.All()
                .KeyColumn("MANAGERIDNUMBER");
        }
    }
}
